# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=elfparser
pkgver=7.39d21ca
pkgrel=2
groups=('blackarch' 'blackarch-binary')
pkgdesc='Cross Platform ELF analysis.'
arch=('x86_64' 'aarch64')
url='https://github.com/jacob-baines/elfparser'
license=('MIT')
depends=('boost')
makedepends=('git' 'cmake')
source=("git+https://github.com/jacob-baines/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

build() {
  cd $pkgname

  mkdir -p build

  cd build

  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr ..

  make
}

package() {
  cd $pkgname

  cd build

  make DESTDIR="$pkgdir" install

  cd ..

  mv "$pkgdir/usr/local/bin/" "$pkgdir/usr/bin"

  rmdir "$pkgdir/usr/local"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

